Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add getTimeout methods to the SDKs #517

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Add getTimeout methods to the SDKs #517

wants to merge 8 commits into from

Conversation

mishushakov
Copy link
Member

  • Adds the ability to retrieve the current timeout of the sandbox via SDK (pre-requisite for events)

Copy link

changeset-bot bot commented Dec 20, 2024

⚠️ No Changeset found

Latest commit: 059348a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@mishushakov mishushakov marked this pull request as ready for review December 26, 2024 20:11
@mishushakov mishushakov requested a review from 0div December 26, 2024 20:11
Copy link
Contributor

@0div 0div left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comments about js-sdk apply to python-sdk.

packages/js-sdk/src/sandbox/index.ts Outdated Show resolved Hide resolved
packages/js-sdk/src/sandbox/sandboxApi.ts Show resolved Hide resolved

await sandbox.isRunning()
sandboxTest.skipIf(isDebug)('get sandbox timeout', async ({ sandbox }) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some assertions around the time left after a waiting for a period of time with reasonable margins could be insightful here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my test pass

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i meant assert that some of the expected time arithmetic is ball park what we would expect, ie setTimeout(1000ms) <=> endAt == now() + ~1000ms

@mlejva
Copy link
Member

mlejva commented Dec 30, 2024

@mishushakov Please add sections/pages to docs so people know this method exists and how it can be used

@ValentaTomas
Copy link
Member

I was checking RFC about adding sandbox state getter (https://github.com/e2b-dev/RFCs/pull/6/files) and I think these are related—maybe the state should be part of the info?

It is possible that we can add the state later, but I would like to have a high-level agreement on where these things should be.

@ValentaTomas ValentaTomas added feature New feature or request sdk Improvements or additions to SDKs labels Jan 7, 2025
@mishushakov
Copy link
Member Author

State can be a part of the info, I agree, but maybe we don't need getInfo as it might be too opaque (what info?) and instead getState() and getEndDate() / getTimeout()

@ValentaTomas
Copy link
Member

Yes, I think having the state, endDate, etc., separated is better here.
We can keep the discussion about state in the RFC and focus on how the endData/timeout should look like here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request sdk Improvements or additions to SDKs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants